urdf/Tutorials/Create your own urdf file

您所在的位置:网站首页 my robot is on my desk urdf/Tutorials/Create your own urdf file

urdf/Tutorials/Create your own urdf file

#urdf/Tutorials/Create your own urdf file| 来源: 网络整理| 查看: 265

Note: This tutorial assumes you are familiar with the xml markup language. Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. Create your own urdf file Description: In this tutorial you start creating your own urdf robot description file.

Tutorial Level: BEGINNER

Next Tutorial: Now that you have a urdf file, you can parse your urdf file, start using the kdl parser, or use the robot state publisher on your own robot

Contents

Create the tree structure Add the dimensions Completing the Kinematics

Create the tree structure

In this tutorial we'll create the URDF description of the "robot" shown in the image below.

The robot in the image is a tree structure. Let's start very simple, and create a description of that tree structure, without worrying about the dimensions etc. Fire up your favorite text editor, and create a file called my_robot.urdf:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

So, just creating the structure is very simple! Now let's see if we can get this urdf file parsed. There is a simple command line tool that will parse a urdf file for you, and tell you if the syntax is correct:1

You might need to install, urdfdom as an upstream, ROS independent package:

$ sudo apt-get install liburdfdom-tools

Now run the check command:

$ rosmake urdfdom_model # only needed if installed from source $ check_urdf my_robot.urdf # hydro and later $ $ # for older ROS distros, use the following commands $ (see footnote at bottom of page for why above commands are different) $ rosrun urdfdom check_urdf my_robot.urdf # groovy $ rosrun urdf_parser check_urdf my_robot.urdf # electric and fuerte $ rosrun urdf check_urdf my_robot.urdf # diamondback and earlier

2If everything works correctly, the output should look like this:

robot name is: test_robot ---------- Successfully Parsed XML --------------- root Link: link1 has 2 child(ren) child(1): link2 child(2): link3 child(1): link4

Add the dimensions

So now that we have the basic tree structure, let's add the appropriate dimensions. As you notice in the robot image, the reference frame of each link (in green) is located at the bottom of the link, and is identical to the reference frame of the joint. So, to add dimensions to our tree, all we have to specify is the offset from a link to the joint(s) of its children. To accomplish this, we will add the field to each of the joints.

Let's look at the second joint. Joint2 is offset in the Y-direction from link1, a little offset in the negative X-direction from link1, and it is rotated 90 degrees around the Z-axis. So, we need to add the following element:

1

If you repeat this for all the elements our URDF will look like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Update your file my_robot.urdf and run it through the parser:3

$ check_urdf my_robot.urdf

If it all looks good, you can move to the next step.

Completing the Kinematics

What we didn't specify yet is around which axis the joints rotate. Once we add that, we actually have a full kinematic model of this robot! All we need to do is add the element to each joint. The axis specifies the rotational axis in the local frame.

So, if you look at joint2, you see it rotates around the positive Y-axis. So, simple add the following xml to the joint element:

1

Similarly, joint1 is rotating around the following axis:

1

Note that it is a good idea to normalize the axis.

If we add this to all the joints of the robot, our URDF looks like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Update your file my_robot.urdf and run it through the parser:4

$ check_urdf my_robot.urdf

That's it, you created your first URDF robot description! Now you can try to visualize the URDF using graphiz:5

$ urdf_to_graphiz my_robot.urdf

and open the generated file with your favorite pdf viewer:

$ evince test_robot.pdf

You are now ready to move to the next tutorial, and start using the URDF parser in your C++ code.

Starting with ROS Electric Eyms, the check_urdf script has been moved from urdf into urdf_parser. In later releases it is moved to urdfdom_model. (1)

The binaries from urdfdom now appear in the path directly and rosrun no longer works: http://answers.ros.org/question/112081/urdfdom-check_urdf/ (2)

Starting with ROS Electric Emys, the check_urdf script has been moved from urdf into urdf_parser. In later releases it is moved to urdfdom_model. (3)

Starting with Electric Turtle, the check_urdf script has been moved from urdf into urdf_parser. In later releases it is moved to urdfdom_model. (4)

Starting with Electric Turtle, urdf_to_graphiz and check_urdf scripts have been moved from urdf into urdf_parser. In later releases they are moved to urdfdom_model. (5)



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3